package com.itheima.controller;

import com.itheima.domain.db.UserInfo;
import com.itheima.service.db.UserInfoService;
import com.itheima.vo.PageBeanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/userInfo")
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    @PostMapping("/save")
    public void save(@RequestBody UserInfo userInfo) {
        userInfoService.save(userInfo);
    }

    @PutMapping("/update")
    public void update(@RequestBody UserInfo userInfo) {
        userInfoService.update(userInfo);
    }

    @GetMapping("/findById")
    public UserInfo findById(Long id) {
        return userInfoService.findById(id);
    }

    @GetMapping("/findUserList")
    public PageBeanVo findUserList(Integer pageNum, Integer pageSize) {
        return userInfoService.findUserList(pageNum,pageSize);
    }
}
